home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / TwinOpus2 / REXX / DOpus / TwinHandler.rexx < prev   
OS/2 REXX Batch file  |  1994-10-13  |  2KB  |  71 lines

  1. /*
  2.  *
  3.  *  Handler to deal with double-clicks in DOpus for TwinExpress.
  4.  *
  5.  * (c) 1994 by K.P. van Beem (2:280/464.2, patrick.van.beem@aobh.xs4all.nl)
  6.  *
  7.  * Based on the DOpusLhaARexx package by Geoff Seeley (but you can better
  8.  * use GuiArc in stead of DOpus and a script, to deal with archives)
  9.  *
  10.  */
  11.  
  12. DOpusPort = 'DOPUS.1'
  13. TwinPort  = 'TWIN.1'
  14.  
  15. if ~show(l,"rexxsupport.library") then        
  16.     call addlib("rexxsupport.library",0,-30,0)
  17. if showlist('Ports', TwinPort) then do
  18.    call ExitIt
  19. end
  20.  
  21. options results
  22.  
  23. /* open our message port */
  24. OurPort = openport(TwinPort)
  25. HandlerStatus = 'OPEN'
  26.  
  27. do until HandlerStatus = 'CLOSE'
  28.    call waitpkt(TwinPort)
  29.    Packet = getpkt(TwinPort)
  30.    if Packet ~= null() then do
  31.       Cmd = getarg(Packet, 0)
  32.       Directory = getarg(Packet, 2) /* entry text   */
  33.       call reply(Packet, 0)
  34.       if Cmd = '1' then do
  35.          address value DOpusPort
  36.          /* Get current directory */
  37.          'Status 6 -1'
  38.          GetEntry Result
  39.          FilePath = Result
  40.          if left(FilePath,1) ~= '*' then
  41.             TopText "You are not in a 'Twin' directory."
  42.          else do
  43.             FilePath = SubStr(FilePath,2)
  44.             /* Check if entry is a directory */
  45.             if SubStr(Directory,26,9) ~= "Directory" then
  46.                TopText "Selected item is no directory."
  47.             else do
  48.                /* Create new path and... */
  49.                if right(FilePath,1) = ':' then
  50.                   FilePath = FilePath || Strip(left(Directory,25))
  51.                else
  52.                   FilePath = FilePath || '/' || Strip(left(Directory,25))
  53.                /* ...command the actually entering of the directory */
  54.                address COMMAND "Rexx:DOpus/ReadDir.rexx" FilePath
  55.             end
  56.          end
  57.       end
  58.       if Cmd = '2' then do
  59.          OtherWindow
  60.          address COMMAND "Rexx:DOpus/CopyFile.rexx"
  61.       end
  62.       if Cmd = 'CLOSE' then
  63.          HandlerStatus = 'CLOSE'
  64.    end
  65. end
  66.  
  67. /* close up shop */
  68. call closeport(OurPort)
  69.  
  70. exit
  71.